# coding: utf-8
from flask_sqlalchemy import SQLAlchemy


db = SQLAlchemy()



class AdministratorToken(db.Model):
    __tablename__ = 'administrator_token'

    auto_id = db.Column(db.BigInteger, primary_key=True, info='自增主键')
    user_id = db.Column(db.BigInteger, nullable=False, info='用户id')
    user_type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户类型 0-普通用户 1-管理员')
    token = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='token值')
    expire_time = db.Column(db.DateTime, nullable=False, info='超时时间')
    is_valid = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='token是否可用 1-可用 0-不可用')
    is_delete = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='逻辑删除')
    create_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='创建时间')
    update_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='更新时间')
